#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) Huoty, All rights reserved
# Author: Huoty <sudohuoty@163.com>
# CreateTime: 2020-12-10 09:54:49

import socket


sock = socket.socket()  # 创建套接字
# 连接远程服务器
sock.connect(('127.0.0.1', 8898))

while True:
    msg_s = input('>>>')
    sock.send(msg_s.encode('utf-8'))
    if msg_s == 'q':
        break
    msg_r = sock.recv(1024).decode('utf-8')
    print(msg_r)
    if msg_r == 'q':
        break

sock.close()
